var app = getApp()
Page({
  data: {
    isLogin: true,
    userInfo:app.globalData.userInfo,
  },
  
  /*
  //授权登录
  login: function (e) {
    var isa = e.detail.errMsg;
    if (isa == "getUserInfo:ok") {
      wx.showToast({
        title: '正在授权',
        icon: 'loading'
      });
      this.setData({ isLogin: true, userInfo: e.detail.userInfo});
      wx.setStorageSync("userInfo", e.detail.userInfo);
      app.globalData.userInfo = e.detail.userInfo;
      app.globalData.isLogin = true;
    } else {
      wx.showToast({
        title: '请授权',
        icon: 'none'
      })
    }
    console.log(e)
  },
  */

  //临时授权
  shouquan:function(){
    var teacher = wx.getStorageSync("teacher")
    var teachid = teacher.teacherID
    wx.navigateTo({
      url: '/pages/provisional/pro-message/pro-message?allID='+teachid,
    })
    // wx.showToast({
    //   title: '加载成功',
    //   icon: 'loading',
    //   mask:true,
    //   duration: 2000,
    //   success:function(){
    //     setTimeout(function () {
    //     }, 1000) 
    //   }
    // })
  },
  
  //长期授权
  longshouquan: function () {
    var teacher = wx.getStorageSync("teacher")
    var teachid = teacher.teacherID
    wx.navigateTo({
      url: '/pages/long-provisional/long-provisional-message/long-provisional-message?allID='+teachid,
    })
    
  },

  //退出登录
  out:function(){
    wx.clearStorageSync();
      wx.redirectTo({
        url: '/pages/firstV2.0/firstV2.0',
      })
  },
  //进出记录
  address: function () {
    wx.navigateTo({
      url: '/pages/teacherlogin/address/address',
    })
  },
  //密码修改
  secrets:function(){
    var teacher = wx.getStorageSync("teacher")
    var teachid = teacher.teacherID
    wx.navigateTo({
      url: '/pages/teacherlogin/password/password?allID='+teachid,
    })
  },
  speak:function(){
    wx.navigateTo({
      url: '/pages/teacherlogin/explain/explain',
    })
  }
})